Nope. Never. They will beat each other up if not kill each other. Some people have done this, but its no fun for either fish, since the female spends her life hiding from the male. I suggest buying seperate tanks.
Yes it is very rare that you will be able to keep both sexes together all the time. I actually kept a male and female PEACEFULY for a few years but both were very passive and it was a 30g communitee.