You'll need to run a script, and use http://www.creationkit.com/sixChange to change the target's gender. Erk... that's a console command, won't work, as far as I know.
You could probably simulate it with just throwing a randomly, pre-made NPC in the spot with http://www.creationkit.com/ObjectReference.PlaceAtMe_%28Papyrus%29 and transfer all their possessions with http://www.creationkit.com/RemoveAllItems_-_ObjectReference