The reason that SO4(2-) has two different structures is the discrepancies between formal charge. One of them is preferable, but that doesn't mean that either structure couldn't exist.
First of all, formal charge is defined by the individual charge of an atom. The most favorable structure is defined by the one that has each individual atom to have the lowest formal charge possible.
Formal charge is defined by the value of the number of valence electrons of the atom in a neutral state minus the number of unbonded electrons - the number of covalent bonds that the atom is attached to.
So, to decide which structure is preferable, look at the formal charges of each atom in each diagram
First diagram: Sulfur has F.C. of 6-(6) = 0. Oxygen with two lone pairs has an F.C. of 6-(2+4) = 0.
Oxygen with three lone pairs has a formal charge of 6-(6+1) = -1.
For your second diagram, look at the formal charges of each individual atom again.
Sulfur: 6-4 = 2.
Oxygen (all have three lone pairs of electrons): 6-(1+6) = -1.
You can see that the formal charges of the atoms in the first diagram are preferential because they are closest to zero. That means that the ion with the first Lewis Dot Structure is most stable. (The negative charge of the sulfate ion is most spread out).