This can be argued either way. There is no absolutely correct answer.
You can argue that democracy works better with socialism. In socialism, there is much more economic equality. This leads to more political equality, which is an important part of democracy. In a socialist system, there would not be any rich people who can have disproportionate influence on the political system by giving money to politicians or running ads in favor of their favorite politicians.
However, you can also argue that capitalism is the better fit with democracy. Capitalism allows people the most possible economic freedom. People have the right to do whatever they want with their property in a true capitalist system. Since democracy is all about personal freedom, it can be argued that democracy works best when there is economic freedom as well as political freedom.