define operator= for B
B::operator=(const A& a)
{
// actual code to copy from a to b.
}
in your code change the line
vecB[i][j] = B::fromA(vecA[i][j]);
to
vecB[i][j] = vecA[i][j];
it will eliminate many temporary A & B objects that are created in your original code.
Also instead of using vecB[i][j] use iterators. Following code may have some syntax errors
vecB.resize(vecA.size());
vector<vector<A> >::const_iterator itA1;
vector<vector<B> >::const_iterator itB1;
vector<A> >::const_iterator itA2;
vector<B> >::const_iterator itB2;
for(itA1=vecA.begin(), itB1= vecB.begin();
itA1 != vecA.end();
++itA1, ++itB1)
{
for(itA2 = (*itA1).begin(), itB2=(*itB1).begin();
itA2 != (*itA1).end();
++itA2, ++itB2)
{
(*itB2) = *itA2;
}
}