Check out https://www.stellar.org/api/#api-payment. By setting Amount.issuer to be the recipient's address, the protocol will find a path from the sender's gateway to the recipient's gateway.
Speaking more broadly, I anticipate many gateways will also become exchanges, to make their credits more valuable, aka more "liquid". For instance, in the last example, what was required to make this work was a "market maker", someone in the middle buying London EUR and selling San Francisco USD. If no direct exchange existed (highly unlikely in this example), there may be a EUR -> XYZ Currency -> USD. To avoid this external dependency (and also offer a cheaper exchange rate), it would be in the London and SF gateway's best interest to trust (https://www.stellar.org/api/#api-trustset) each other. Then, the exchange from her EUR credits to your USD credits would happen directly.