There were many reasons why it was successful in WWII, but not in WWI. For one thing, General Joffre's swift decision to abandon Plan XVII and shift French forces northwards at the end of August allowed the French to meet the German 1st and 2nd Armies along the Marne with a greater concentration of forces (combined with the 6th Army and the BEF, the allies had c. 40 divisions on the Marne to the Germans 20-25). In 1914, the Germans proved unable to concentrate enough forces at a decisive point to seize the initiative from the French. In 1940 however, General Gamelin sent the 7th Army to aid the Dutch, which left the Allies with no appreciable strategic reserve when Army Group A broke through in the Ardennes. This led to the evacuations at Dunkirk, and even though the French re-established defenses on the Weygand Line, they were outnumbered and had lost the initiative, while their leadership was losing faith in French abilities to resist.
There were other factors aside from the ability of the French to match German attacks with their reserves. Radios and mechanized/motorized units allowed for greater mobility, meaning that actions could be pursued decisively. Lack of effective communications and reliance on horse transport hampered the German invasion in 1914, but this was different in 1940 with the Germans possessing substantial mobile forces. The presence of the Luftwaffe was also important, carrying out reconnaissance, flying tactical interdiction missions, and maintaining air superiority against the Allies, albeit at great cost (c. 1500 aircraft).
The advances in technology can't be understated. WWI resupplying relied heavily on railroads. Once a military advance went beyond the reach of the railroads, they became much more difficult to resupply. By WWII motorized transport was common enough that military units could move faster while carrying more supplies, and that supplying them far from rail lines was easier.
Another big factor to consider is the inter-war years. WWI had broken both France and Germany in a lot of ways they were still trying to recover from. France had gone through many governments and was dealing with demonstrations and extremist factions. There was a genuine worry that given time France could wind up going Fascist or Communist. Their military had also done a poor job modernizing. They didn't take the right lessons away from WWI and wound up with a lot of outdated doctrine and technology while pouring most of their funding into the Maginot Line.
In Germany, meanwhile, while initially hamstrung by war reparations, the Nazi takeover led to a lot of experimentation and modernization in the military. France's military was commanded by a bunch of old conservatives, while Germany had a lot of fresh faces with new ideas to try out. The result is that what army France had was not much better than what they had in 1918, while Germany had put together a military that had fully taken advantage of the inter-war years.
I'm currently reading To Lose a Battle: France 1940 by Alistair Horne. It's a pretty good read that goes much more in depth into the subject, while his other books in the series go into WWI and the Austrio-Prussian war.