Are slats only used when there is a short runway or on all occasions?
On all occasions when flaps are deployed.
Slats are a necessity when the wing uses slotted flaps or Fowler flaps for maximum lift. Those flaps cannot reach over the whole span of the wing to leave room near the wingtips for ailerons.
Once the flaps are extended, they increase the incidence of the wing along the flap span. This leaves the outer wing at a lower incidence, but in the vortex field of the inner wing. This vortex field induces a high local angle of attack over the whole wingspan, which would produce a local stall at the wingtip, where the ailerons prevent the use of slotted flaps. This stall would in most cases be asymmetric: One wing tip loses lift while the other barely manages to get along with the high angle of attack. The result is a strong rolling moment which will even increase once the aircraft starts to roll, because the local angle of attack at the down-moving wing will increase further. At this condition, the ailerons are of little help, so the roll cannot be controlled.
Angle of attack change due to movement (own work)
Now consider when flaps are used most often: Close to the ground, during take-off and landing. Then imagine what happens when the airplane rolls over one wing uncontrollably. To avoid this, slats are very helpful: They give the wing an extra stall margin by shifting the stall angle up.
While the Airbus in your picture uses slats over the whole wing, they are strictly needed only at the outer wing. Adding them ahead of the slotted flaps will increase the maximum lift and reduce the minimum speed over what is possible with flaps alone, so full-span slats (sometimes combined with Krüger flaps on the inner part of the wing) are now standard.
The slats are high lift devices which allow the wings to operate at higher angles of attack. In most of the aircraft, the slats are deployed automatically when the flaps are deployed.
The flaps are deployed to increase the camber of the airfoil seaction, which increases the lift coeffecient (and reduces the stall speed). However, the flaps also reduce the stall angle, so the wings stall earlier (at lesser angles of attack). Better the flaps are in increasing lift coeffecient, more this reduction in stall angle is.
During landing and takeoff, when the flaps are deployed, are the conditions when the angle of attack is high. The addition of slats increases the stall angle, so that the wing angle of attack can be high without any danger of stall.
Due to this reason, the slats are used in all occasions when the flaps are deployed (during takeoffs and landings). Actually, the flap/slats are controlled by the same lever so that the slats are deployed whenever the flaps are extended. For example, the Embraer 190 flap/slat control lever looks like this:
According to Embraer 190 Flight control System Summary,
Slat and flap motion is sequenced such that slats extend first and flaps retracts first when the motion command requires both surfaces to move.