You can use a buck converter.
For this, you can use a dedicated controller for such a purpose or you can use a general-purpose PWM chip like UC3845.
If you use the second suggestion, you need to design a start-up section which can be a simple resistor. You can use the UC3845 to drive N-channel MOSFETs in high-side configuration. For this you will need high-side drivers such as IR2117. You would need an inductor and capacitor. Then, you'll need a feedback section to keep the output fixed.
If you use buck-converter, you would need 2 buck converters, one for 12V and one for 5V.
Another thing you can do is, use a transformer-isolated converter, so you can use one controller and a MOSFET stage driving a transformer with two output windings (and maybe an auxiliary for powering the controller or you can use the output 12V for powering the controller). A simple circuit would be an SG3525 driving 2 MOSFETs in push-pull configuration.
Hope this helps.
Tahmid.