Superconductivity, antiferromagnetism and phase separation in the two-dimensional Hubbard model: A dual-fermion approach