Current Source and Current Sink
A first approximation for the NPN circuit would be:



Where D4 represents the Base-Emitter junction. It is clear that the added voltages across D2 and D3 equals the voltage across D4 added to the one across R1. Since the voltages across diodes directly polarized don't vary too much with the current, it is also clear that the voltage across R1 is similar to a voltage drop across a diode.

\$V_{D2}+V_{D3} = V_{D4} + V_{R1}\$

\$ V_{D2} \approx V_{D3} \approx V_{D4}  \$

Analyzing the circuit with the transistor, if it is kept far from the saturation, the base current will be a small fraction of the emitter current. If \$V_{R1}\$ doesn't change considerably, also its current will remain practically constant. Since \$ I_C \approx I_E \$, the circuit will keep the current entering the collector almost constant. To do that the \$V_{CE}\$ will change, so if the transistor goes into saturation, the current control will not be effective.

Maybe it easier to understand if you connect a load resistor (\$R_L\$) between the collector and the voltage supply. You can vary \$R_L\$ from 0 to a value which allows the \$V_{CE}\$ voltage to stay above the saturation voltage.



Just flip everything upside down for the PNP circuit.