how these circuits work?
What you have in the first schematic is a buck-converter. This is a special kind of switched-mode power supply, intended to regulate a higher voltage to a lower one. But instead of regulating a constant output voltage, it is using the resistor Rsense to regulate a constant current (when the voltage across Rsense is constant, so is the current through it). This ensures that the current through the LEDs is always the same, regardless of possible losses in the cables, or changing input voltage.

The second circuit is nearly the same, but uses a separate constant-current regulator after the buck converter. So the converter operates in constant voltage mode, and the separate regulator is responsible for creating a constant current flow.

Using a switching regulator, instead of a linear one, leads to reduced power losses, and reduces the created heat.