As far as I understand, what you call $f_P$ is usually called monomial symmetric function as is denoted $m_P$. So I interpret your question as asking for an algorithm converting monomial symmetric funtions to power sum symmetric functions. Such an algorithm seems to be described here:
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4656270/
Also there is one which was implemented in Symmetrica (which is the one used in Sagemath) more than twenty years ago. I don't think the algorithm was documented anywhere but as a comment in the code (the file is called tmp.c
) . The comment seems to indicate that they use a recursive divide and conquer method using the following recursion step:
$$ m_{a_1,a_2,...,a_n,a_{n+1},...a_{2n}} = m_{a_1,...,a_n} * m_{a_{n+1},..,a_{2n}} - \text{terms of length} <2n $$
You can compute the rest of the terms using this answer.
Anyway, unless you really need to say something about the algorithm, I would recommend using a computer algebra system which already has this algorithm implemented.