You are asking whether for a matrix Lie algebra $\mathfrak{g}$, all automorphisms are inner automorphisms. The answer is no in general. E.g. for $n \ge 3$, the map
$$X \mapsto -X^{t}$$
(negative of the transpose) is an automorphism on the Lie algebras $\mathfrak{sl}_n(\Bbb C)$ and $\mathfrak{gl}_n(\Bbb C)$ which is not given by conjugation with a matrix. (Fun exercise: For $\mathfrak{sl}_2(\Bbb C)$, it is still an automorphism but an inner one, i.e. it is induced by conjugation with a certain matrix.)
In general, the automorphisms of simple (split) Lie algebras are pretty well understood. The existence of outer automorphisms can be read of the Dynkin diagram, and they exist in types $A_{n\ge 2}, D_{n \ge 3}$ and $E_6$. For a discussion see https://mathoverflow.net/q/14735/27465 and ch. VIII §5 of Bourbaki's Lie Groups and Algebras.
For other types of Lie algebras which might be represented as matrices (e.g. solvable ones, and even non-split semisimple ones over arbitrary fields), I have no idea, but I guess the answer is still "no" in general.
For split real semisimple Lie algebras, yes. Otherwise, not necessarily.
Namely, if I'm not mistaken, in the notation of Bourbaki's Groupes et algèbres de Lie, your first ("algebraic") definition is denoted as $Aut_{e}(\mathfrak{g})$ (cf. ch. VII §3 no. 1 definition 1 and ch. VIII §5 no. 2). The second ("analytic") definition is denoted as $Int(\mathfrak{g})$ (cf. ch. III §6 no. 2 definition 2). And they prove that for a semisimple split Lie algebra over $\Bbb R$ or $\Bbb C$, we have $Aut_e(\mathfrak{g}) = Int(\mathfrak{g})$, in ch. VIII, §5 no. 5 proposition 11(iv).
$\mathfrak{g}$ being split here means that there exists a splitting Cartan subalgebra (i.e. one that consists of ad-diagonalisable instead of just ad-semisimple elements). Over $\Bbb C$, that is of course an empty condition, but over $\Bbb R$, it severely restricts the scope of the theorem, as it excludes the plethora of non-split real semisimple Lie algebras which exist.
For those, the theorem is certainly not true in general. As an extreme case, take any compact real Lie algebra, e.g. $\mathfrak{su}_n$. Those contain no nonzero nilpotent elements at all, so that $Aut_e(\mathfrak{su}_n)$ is trivial. However, if I understand this MO post correctly, we have e.g. $Aut(\mathfrak{su}_2) = Int(\mathfrak{su}_2) \simeq SU(2)/\pm I \simeq SO(3)$.
Finally, let me note that I find ch. VIII §5 of that Bourbaki volume one of the best treatises on automorphisms of simple Lie algebras, and to add to the existing ambiguity, it's actually interesting to look at a third possible group they call $Aut_0(\mathfrak g)$, which are the automorphisms which become elementary after scalar extension to an algebraic closure. This is related to the real Lie algebra $\mathfrak{sl}_2(\Bbb R)$ having a "non-inner" automorphism called $\varphi$ in this answer, even though one usually thinks of $\mathfrak{sl}_2$ as not having outer automorphisms. (This one, in this case, is in $Aut(\mathfrak g)= Aut_0(\mathfrak g)$ but not in $Aut_e(\mathfrak g)$.)
Best Answer
If $\mathfrak{g} , \mathfrak{h}$ are Lie algebras, a homomorphism of Lie algebras is a map $T : \mathfrak{g} \to \mathfrak{h}$ which (a) is a linear homomorphism, and (b) satisfies $$[T(x), T(y)]_{\mathfrak{h}} = [x, y]_{\mathfrak{g}}$$ for all $x, y \in \mathfrak{g}$. A Lie algebra automorphism will be a Lie algebra homomorphism of a Lie algebra to itself which is also invertible.