I have a controller and view file, from controller I am setting the data array for view, in the view file I am creating an instance of Mustache.php class and render the template of view.
In the second scenario: from controller I am setting the data array for view, and from view file I am calling Mustache.js to render a template.
Please let me know which is Ideal approach to do the same?
I am using PHP sonic framework(MVC)
Both of them are OK. If you use PHP, you won't deal php-js conversion. Php mustache instance keeps you from conversion.
Note: A note for your MVC usage:
Mustache is logicless template. This means you need to prepare your data structure in controller and pass it to the view. Do not use filtering, conditioning, controlling structures on your view.