They are synonymous, but can't always be used interchangeably.
As pessoas is more formal. A gente is an exact synonym of nós. You can always use a gente in place of nós (however they are conjugated differently -> nós somos, a gente é; nós gostamos de, a gente gosta de etc.), however, this is informal language. Hope this explains it!