Do it little by little.
Like a learner driver, go find a car park or a quiet road, you don't want to be doing this in the traffic. Ironically, you probably don't want to be doing this on a surface that will give you a soft landing. I suppose a flat playing field might work, but cycling on grass isn't as smooth as cycling on tarmac and you'll need a predictable, flat surface to work with.
The biggest skill to master is steering through weight, not through moving the handlebars. You probably do this anyway, but it's something to work on deliberately while you've got two hands on the bars. Just sway your weight from side to side and try to go in the direction you want - in a moment you'll be steering like this for real, so try and get it going well when you don't need it.
I don't think it's worth going one handed first - this is an all-or-nothing exercise. Get going in a straight line with your hands lightly on top of the bars (if you're on dropped handle-bars) and just relax your hands. Hold them flat on the bars and just lift them. Don't look at them. Just lift them a little. A fraction of an inch will feel like a foot ...
But then just try to do things with the hands off the bars. Do the leaning and swaying from side to side. Just a little amount. Just enough to drift a little off line then get you back going in a straight line. Then once you're happy, try to sit up. The more you practice, the less of a problem this becomes.
You will feel very unsteady as your centre of gravity moves around. The key here is that on most bikes your centre of gravity is quite low, somewhere around your knees, but as you take your hands off the bars and sit up, it rises significantly, so you need to be happy in controlling it and how to react to how the bike is taking it.
Pretty soon you'll be taking corners.
Of course, don't forget that, unless you're on a fixed or have non-standard equipment, the only way to stop suddenly is probably quite painful ...