My questions are:
1 Can I write comprises 'of' instead of 'comprises' in both the sentences?
And
2 If they are not interchangeble, then when should we write 'comprises of'?
You have specifically asked about when to write 'comprises' and 'comprises of'.
I would tell my students (EFL/ESL students in the USA) to never write 'comprise(s) of'. Why? It is not good academic English.
For instance, when you look up comprise in the Oxford Dictionary Online (ODO), under Usage it states:
the construction comprise of, as in 'the property comprises of bedroom, bathroom, and kitchen', is regarded as incorrect.
Notice this is talking specifically about the active sense of comprise(s) of. The ODO allows that the passive uses is/are comprised of are part of standard English.
In fact, comprise(s) of is rarely written at all. Take a look at the following graph from Google Ngram, which counts the number of times a word or phrase appears in the 5.2 million books digitized by Google. As you can see, from 1900 to 2000, the versions comprise of and comprises of look like airplanes that never get off the ground.
Simply put,
comprise of and
comprises of are rarely ever used. And they are certainly not considered standard English.
Note: this answer is based on what is considered standard or academic English in the USA and Great Britain. In other Englishes, such as in the Englishes spoken in India and various African countries, you might encounter many more uses of comprise(s) of. (This is based on the actual instances of those phrases found in a Google Book search.) Whether they are considered standard in the Englishes of those countries is unknown to me.