How can it be that Melkor created the orcs and Aule created the dwarves, when both needed The Imperishable Flame (The Secret Fire)?
It is established in the Silmarillion that only Eru Iluvatar possesses the capacity for true creation, to give the spark of life. He made Elves and Men and put them in Arda. So how did the Dwarves and Orcs come about?
Aule and the Dwarves
In Ch.2 of the Silmarillion it is shown that Aule made the Dwarves, but was incapable of giving them true life. It is only when Iluvatar directly intervenes, seeing that Aule's act was not one of hubris, but motivated by a desire to teach, that he embraces Aule's Dwarves and makes them truly alive:
But Ilúvatar had compassion upon Aulë and his desire, because of his humility; and the Dwarves shrank from the hammer and were afraid, and they bowed down their heads and begged for mercy. And the voice of Ilúvatar said to Aulë: 'Thy offer I accepted even as it was made. Dost thou not see that these things have now a life of their own, and speak with their own voices? Else they would not have flinched from thy blow, nor from any command of thy will.'
Melkor and the Orcs
There is already a good question about the origin of the orcs. In short, Tolkien himself had several different explanations at different times, but the most common one, and the one referenced in the Silmarillion, is that Melkor kidnapped Elves and corrupted them to become Orcs:
Yet this is held true by the wise of Eressëa, that all those of the Quendi who came into the hands of Melkor, ere Utumno was broken, were put there in prison, and by slow arts of cruelty were corrupted and enslaved; and thus did Melkor breed the hideous race of the Orcs in envy and mockery of the Elves, of whom they were afterwards the bitterest foes. For the Orcs had life and multiplied after the manner of the Children of Ilúvatar; and naught that had life of its own, nor the semblance of life, could ever Melkor make since his rebellion in the Ainulindalë before the Beginning: so say the wise.
So in both cases, the Secret Flame was involved in their creation, whether directly by Eru's intervention, or indirectly through the corruption of the Elves.