No, they are not equal in meaning. "一緒に", as already stated by some people, is used more in casual situations. I can't imagine people saying "共に" in usual conversations but I can easily imagine a politician saying "共に". However, I wouldn't call "一緒に" an informal word or "共に a formal word. I would say "共に" sounds more solemn than formal.
Now, the question is where is the boundary to decide when to use which one, "一緒に" or "共に"?
- a.)一緒にがんばろう [To your friend(s) or family member(s)]
- b.)一緒にがんばりましょう [To your colleague(s) or people in business relationship. You can say this to someone you've just met if needed.]
- c.)共にがんばろう [To your subordinates/students. Even though "がんばろう" is not a formal form, it would still sound weird in casual conversations among friends/family members]
- d.)共にがんばりましょう [nearly the same as b.) probably because the situations where "共に" is allowed are overlapped by the ones where "がんばりましょう" is allowed.]
"共に" sounds more solemn than "一緒に", by which I mean, "共に" places more importance on the task that will be done together. "共に" makes you feel like you are part of "something big" giving the speaker more power. This explains why it can't be used in casual conversations. "共に" gives the hearer more impression and emphasizes the importance of the task.
You should use "一緒に" in usual conversations if you are not making a public speech or talking to a business partner. Literature prefers ”共に" because of its solemnity. Your example, 彼女とともに日本へきた。sounds like a sentence right out of a novel or a character's monologue.
Also, "共に" tends to be used in advertising or invitation, in order to show how serious we are about what we are going to do together.