Generally you can feel when the boat is going to capsize. If you can sense it early enough, you may have time to quickly ease the mainsheet, and scramble over the side, placing your weight on the centerboard just as it reaches the horizontal position (be careful not to fall into the sail, as you may tear a hole in it, or worse off, hurt yourself).
Don’t put all your weight on the end of the centerboard, as this may cause unnecessary stress on the fin and hull. Rather, put your feet on the centerboard close to the hull, grab the deck where it meets the hull, and lean back. As long as the mainsheet is eased, it should pop back up fairly quickly. When it does, quickly get back into the cockpit, sort out the ropes and tiller, get your bearings, and head off once again.