HINT: Start with a DFA $M$ that recognizes $L$. Let $Q$ be the set of states of $M$, and let $s_0$ be the initial state. For each $w\in L$ let $Q(w)$ be the set of states through which $M$ passes when reading $w$, and let $Q_0=\bigcup\{Q(w):w\in L\}$; every state in $Q_0$ is the initial state for some word in $P$, so add an $\epsilon$-transition from $s_0$ to each $q\in Q_0$. Call the new automaton $M_1$; $$L(M_1)=\{v\in A^*:uv\in L\text{ for some }u\in A^*\}\;.$$
This does half the job.
Now suppose that $q\in Q(w)$ for some $w\in L$; then there is some $v\in A^*$ that takes $M$ from $q$ to an acceptor state. If $u\in A^*$ is any word that takes $M$ from $s_0$ to $q$, $uv\in L$. Modify $M$ by making each state in $Q_0$ an acceptor state, and call the resulting automaton $M_2$; $$L(M_2)=\{u\in A^*:uv\in L\text{ for some }v\in A^*\}\;.$$
Now just combine the ideas.