Pretty even trade in my mind.
Both teams are dealing from a position of strength:
The Giants have Lincecum, Cain, Bumgarner, Vogelsong and Zito in the starting rotation
The Royals have Gordon and Francoeur in left field and right field. Rookie Lorenzo Cain, picked up in the Greinke trade, figures to get his shot in CF.
Both teams are receiving a position of weakness
All Giants outfielders combined produced just a few more WAR than Melky's 4.2 last year.
Royals' starters were among the worst in the AL in ... well ... about every stat.
Both players are going into their final arbitration years. Melky made $1.25 million last year and figures to make around $4 million this year. Sanchez made $4.8 million and will probably make around $6 million this year.
Melky is coming off of the best season of his career. Sanchez is coming off of the worst of his.
I'm a bigger Melkman supporter than most, but I don't expect him to repeat his 2011 where he hit .339/.470 with 44 doubles, 5 triples and 18 home runs. Melky's 2011 slugging percentage was about 24% higher than his career average. Melky is probably more of a 2-3 WAR player than a 5 WAR player. That's still better than anyone the Giants rolled out in 2011.
Sanchez has been a pretty steady contributor since becoming a full time starter in 2008, averaging 2.4 fWAR per season. Last year was derailed due to some injuries. Sanchez' injury was to his ankle, not his arm, so he's more likely to come back without too much attrition.
The most likely outcome of this trade is both players put up about 2.5 WAR while being paid between $4 and $6 million.
Melky is a little cheaper, and hitters are surer things than pitchers, generally. So San Fran throws in another prospect, Ryan Verdugo, to make up the difference.
Verdugo is a 24 year old AA lefty pitcher. He started 25 games last year, but was a reliever previously. As a reliever he had high strikeout rates (35%) while also walking his share (15%). As a starter, both rates dropped (24% K's and 11% walks). As a starter he doesn't look like more than a #5.
To sum up. Two teams improve weaknesses by dealing equally valuable players from a position of strength.