From vv. 18-19, it seems that David only took back what the Amalekites had previously plundered (and per verse 16, that was from the Jews and, lehavdil, from the Philistines):
יח וַיַּצֵּל דָּוִד, אֵת כָּל-אֲשֶׁר
לָקְחוּ עֲמָלֵק; וְאֶת-שְׁתֵּי
נָשָׁיו, הִצִּיל דָּוִד. יט וְלֹא
וּבָנוֹת, וּמִשָּׁלָל, וְעַד
כָּל-אֲשֶׁר לָקְחוּ, לָהֶם: הַכֹּל,
The Gemara (Bava Kamma 114a) states that if a Jew rescues another Jew's property from a non-Jewish bandit, we have to assume that the original owner didn't give up hope of retrieving it, and therefore it has to be returned to its owner. This is cited as halachah in Shulchan Aruch, Choshen Mishpat 368:1. So the Amalekites never actually legally acquired whatever they had taken from Tziklag and other Jewish towns, and thus David was fully justified in taking what was originally his and his men's (and returning whatever was recognizable to its original owners). Whereas in Shaul's case: even if we grant that perhaps some of the Amalekite property was also previously plundered from the Jews or from other nations, it wasn't recognizable as such.