Let $\mathcal{A}$ be a complete boolean algebra.
Let $ D $ be a set of $ \mathcal{A}-names $, and $ f:D \to \mathcal{A} $ any function (itself a name).
I wonder if it's possible to construct $ \sigma $ a $ \mathcal{A}-name $ satisfying:
$$ \forall x \in D \,\, [x \in \sigma] = f(x) $$
If not, maybe there are conditions over $f$ that makes it possible.
No, this is not possible in general. A necessary and sufficient condition on $f$ is that for all $x,y\in D$, $f(x)\wedge [x=y]\leq f(y)$. It is obvious that this is necessary, since for any $\sigma$ we must have $[x\in\sigma]\wedge[x=y]\leq [y\in \sigma]$.
For sufficiency, suppose $f$ satisfies this condition and simply let $\sigma=f$. By definition, we have $$[y\in f]=\bigvee_{x\in D}([x=y]\wedge f(x)).$$ By hypothesis, if $y\in D$, then every term on the right is at most $f(y)$ so $[y\in f]\leq f(y)$. On the other hand, by taking $x$ to be $y$, we see that one of the terms on the right is $f(y)$, so $[y\in f]\geq f(y)$.