As a practicing Anglican, I can answer this question. The churches of the Anglican Communion recognize the validity of Holy orders conferred by the Roman Catholic Church, so that a Bishop, Priest or Deacon who converted from Catholicism to Anglicanism, would remain a Bishop, Priest or Deacon, and could serve in the appropriate roles in the Anglican Church, subject to the relevant canon(s) of the various constituent churches of the Communion. It is also probably true, that a Catholic Bishop, Priest, or Deacon could be permitted to exercise his role in an Anglican church on a one time basis. In either case, though, whether a full conversion or a one time event, this would violate Roman Catholic canon law, and the Catholic Priest, Bishop, or Deacon, would likely be automatically excommunicated by virtue of having performed the act.
As far as going the other way, the Roman Catholic Church does not recognize Anglican orders as being valid, so an Anglican converting to Catholicism would likely have to be re-ordained, or have other dispensation from Rome. This does, in fact, happen, and there are some number of Anglican clergy who have converted, been ordained, or received a dispensation, and serve as Priests in Roman Catholic environments, even when those Priests are married.