It's not cherry picked, and the S&P prices have been adjusted for dividends. I'm pretty sure that if you pick two other intervals, both assets will perform equally well.
Edit: yes, there is some selection bias in my intervals:
1970s: gold beats SP500 by a mile
1980s: gold stagnates, SP500 soars
1990s: same as 80s
2000s: see 1970s
2010s: so far, SP500 is ahead.
Conclusion: you need a VERY long investment horizon to compare these two assets.