You can buy such a thing. That is the best option.
If you just need a small current and you want to control it with the Arduino, it is possible.
For example a coil and a mosfet as the main components.
Two voltage dividers to measure the 12V and the 24V.
And a PID software control.