They're statements, rather than idioms, and, apart from the lack of capital 'W's, they're both correct grammatically.
The second one is something which you're more likely to say, though.
'What's mine is yours' means that I'm happy for you to consider my belongings as your own. It's a generous offer.
'What's yours is mine' is less friendly - if you say this, you're laying claim to my property. Nobody would be very happy if another person said this to them.