I think in all situations where either 一緒に
could be used, 二人で
can also be used, and vice versa. I suppose 三人、四人、五人、etc. can also be used here if that's the number of people you are talking about.
But I'm curious as to the different connotations (if they exist) in these words/phrases.