Density of random matrix only depends on its spectrum Suppose a random positive definite matrix $A\in\mathbb{R}^{n\times n}$ has density function (with respect to the lebesgue measure on $\mathbb{R}^{n(n+1)/2}$)  $f(A)=g(\lambda_1(A),...,\lambda_n(A))$ where $g$ is a function invariant under permutation of coordinates and $\lambda_1(A),...,\lambda_n(A)>0$ are eigenvalues of $A$, i.e. the density of $A$ only depends on its spectrum. Examples include Wishart distribution (with identity covariance), matrix beta distribution, etc.
Now, we construct another random matrix in the following way: first generate a diagonal matrix $\Lambda$ such that the joint distribution of the diagonal elements is the same as the joint distribution of the eigenvalues of $A$; second we generate an orthogonal matrix $P\in O(n)$ uniformly and INDEPENDENT of $\Lambda$; then we set $B=P\Lambda P^T$.
Now my question is that is the distribution of $B$ the same as the distribution of $A$? If it is true, how do we prove it? It seems obvious but I do not know how to rigorously justify it. 
Update:
Thank @Iosif Pinelis for giving an counter example! A further question is that, do the diagonal elements of $B$ have the same distribution as $A$'s diagonal elements?
 A: $\newcommand{\tr}{\operatorname{\mathrm tr}}
\newcommand{\R}{\mathbb{R}}
$
The answer is (of course) no (because the Lebesgue measure on the set $\mathbb{R}^{n(n+1)/2}$ of all possible vectors corresponding to on-and-above-diagonal part of the symmetric matrix $A$ has little to do with with the spectrum of the matrix $A$). 
E.g., let $n=2$ and write $A=\begin{bmatrix}a&b\\b&c\end{bmatrix}$. The condition that $A$ is positive definite means exactly that $\tr A=a+c>0$ and $\det A=ac-b^2>0$. Suppose that 
\begin{equation}
 f(A)=f_A(a,b,c):=kI\{0<\tr A<1,\det A>0\}=kI\{0<a+c<1,b^2<ac\},
\end{equation}
where $I$ denotes the indicator and 
$k:=\frac{12}\pi$, 
the normalizing factor that makes $f$ a probability density with respect to the Lebesgue measure on the set $\mathbb{R}^{2(2+1)/2}=\mathbb{R}^3$ of all triples $(a,b,c)$. Moreover, $f$ depends on $A$ only through the spectrum of $A$.
The expected value of the product of the diagonal entries $a,c$ of $A$ is 
\begin{equation}
 EA_{11}A_{22}=\iiint\limits_{\R^3}ac f_A(a,b,c)\,da\,dc\,db=\frac9{80}.  
\end{equation}
We may write the orthogonal random matrix $P$ as $R_T$, where $T$ is independent of $A$ and uniformly distributed in the interval $[0,2\pi)$, and $R_t=\begin{bmatrix}\cos t&-\sin t\\\sin t&\cos t\end{bmatrix}$. The product of the diagonal entries of $B=R_T\Lambda R_T'$ is 
\begin{equation}
 B_{11}B_{22}=\tfrac18\, [a^2+c^2 - b^2 + 6 a c  - ((a-c)^2+ b^2) \cos4 t]. 
\end{equation}
Hence, 
\begin{align}
 EB_{11}B_{22}&=\int_0^{2\pi}\frac{dt}{2\pi}\iiint\limits_{\R^3}B_{11}B_{22} f_A(a,b,c)\,da\,dc\,db =\frac{81}{640}\ne\frac9{80}=EA_{11}A_{22}. 
\end{align}
Thus, (the diagonal entries of) the random matrices $A$ and $B$ are not equal in distribution. 
