In the above the green engines/pumps are Carnot, and the brown ones are irreversible. Because the Carnot engine is reversible, if the engine efficiency is , the pump efficiency is . (See here for details.)
I) In the first case, a Carnot pump is driven by an engine. Overall, to avoid violating Clausius's statement of the second law, there must be no net heat transfer to the hot reservoir, so . Also, by conservation of energy, . Thus
II) In the second case, a Carnot engine drives a pump. Now we need . Thus
So no engine can be more efficient than a Carnot engine, and no pump can be more efficient than a Carnot pump.
If the brown pumps were in fact reversible, there could be no overall heat flow, since heat flow from a hot to a cold body is an irreversible process. In that case the inequalities would become equalities.
Thus any reversible engine working between two heat reservoirs has the same efficiency as any other.