They are both adapted from the Roald Dahl book, 'Charlie and the
Chocolate Factory'.
Roald Dahl was involved in writing the screenplay for the 1971
film - Willy Wonka and the Chocolate Factory, but because he failed
to meet certain deadlines, the screenplay was completed by David
Seltzer. Dahl later said that he had been disappointed in the
amount of emphasis put on the Willy Wonka character and disowned
the film. We can't know what he would have made of the 2005 effort,
- Charlie and the Chocolate Factory, because Dahl passed away in
1990.