In the example sentences I can find, they are both translated as "This is X" so I don't know how to choose between them.
私が料理に使ったのはこれです。 This is what I used in the cooking.
彼が私を感動させた言葉はこれです。This is the word that moved me.
Let's use 'えんぴつ' as an example:
これはえんぴつです = This is a PENCIL.
えんぴつはこれです = THIS is a pencil.
We can imagine changing the emphasis in the words. The first would be someone grabbing a pencil and asking 'What is this?'. The answer is the first example: 'This is a PENCIL'.
In the second let's picture someone holding a pen and asking: 'Is this a pencil?'. You would grab a pencil and answer: 'No, THIS is a pencil' (as in the second case)
なになにはこれです。 Literally: XX is this.
これはなになにです。 Literally: This is XX.
For the first one to be used, the subject of the conversation has to be なになに, because this is what you describe in the sentence.
But in the second one, you describe これ.
I don't think this needs further explanation...